<include file="layout/header" />
<style type="text/css">
    *{
        box-sizing: border-box;
        -webkit-box-sizing: border-box;
    }
    .img_box img{
        float:left;
        margin:10px 10px 0;
        max-height:100px;
    }
    .searchCreater{
        position:relative;
    }
    .searchCreater .createrName{
        width:100%;
        border:1px solid #ccc;
        height:32px;
        padding:0 10px;
        cursor:pointer;
        transition: all ease-out 200ms;
        -webkit-transition: all ease-out 200ms;
    }
    .searchCreater .createrName span{
        float:left;
        width:50%;
        height:100%;
        line-height:32px;
        color:#999
    }
    .createrBox{
        position:absolute;
        width:100%;
        padding:4px 0;
        border:1px solid #66afe9;
        border-top:none;
        z-index: 1000;
        background:white;
    }
    .createrBox input{
        display: block;
        width:98%;
        height:32px;
        margin:auto 6px;
        border:1px solid #ccc;
        padding-left:10px;
        margin:0 auto;
        outline:none;
    }
    .createrBox ul{
        width:98%;
        margin:4px auto 0;
        max-height:200px;
        overflow-y:scroll;
    }
    .createrBox li{
        width:100%;
        height:32px;
        background:white;
    }
    .createrBox li span{
        float:left;
        width:50%;
        padding:6px 10px;
    }
    .createrBox li:hover{
        color:white;
        cursor:pointer;
    }
    .createrBox li:hover span{
        background:#3276b1;
    }
    .regPlace select{
        height:32px;
        width:75%;
        border:1px solid #ccc;
        cursor:pointer;
    }
    label i{
        border-radius:50%;
        margin-right:8px;
        vertical-align: middle;
        font-size:16px;
        font-weight: bold;
        line-height: 14px;
        text-align:center;
        color:red;
        display: none;
    }
</style>
<div id="content">
    <section id="widget-grid" class="">
        <div class="row">
            <article id="aaa" class="col-sm-12 col-md-12 col-lg-8 sortable-grid ui-sortable">
                <div class="jarviswidget jarviswidget-sortable" id="wid-id-0" data-widget-colorbutton="false" data-widget-editbutton="false" role="widget" style="">
                    <header role="heading"><div class="jarviswidget-ctrls" role="menu">   <a href="#" class="button-icon jarviswidget-toggle-btn" rel="tooltip" title="" data-placement="bottom" data-original-title="Collapse"><i class="fa fa-minus"></i></a> <a href="javascript:void(0);" class="button-icon jarviswidget-fullscreen-btn" rel="tooltip" title="" data-placement="bottom" data-original-title="Fullscreen"><i class="fa fa-resize-full "></i></a> <a href="javascript:void(0);" class="button-icon jarviswidget-delete-btn" rel="tooltip" title="" data-placement="bottom" data-original-title="Delete"><i class="fa fa-times"></i></a></div>
                        <span class="widget-icon"> <i class="fa fa-eye"></i> </span>
                        <h2>产品修改</h2>
    
                    <span class="jarviswidget-loader" style="display: none;"><i class="fa fa-refresh fa-spin"></i></span></header>
    
                    <!-- widget div-->
                    <div role="content" style="display: block;">
    
                        <!-- widget edit box -->
                        <div class="jarviswidget-editbox">
                            <!-- This area used as dropdown edit box -->
    
                        </div>
                        <!-- end widget edit box -->
    
                        <!-- widget content -->
                        <div class="widget-body">
                            <form id="regForm" class="form-horizontal" method="post" action="{{:url('manage/Product/pupd')}}" enctype="multipart/form-data">
                                <div class="form-group">
                                    <label class="col-md-2 control-label"><i>&times;</i>产品名称</label>
                                    <div class="col-md-10">
                                        <input class="form-control" name="name" placeholder="请输入产品名称" value="{{$infos['name']}}" type="text">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label"><i>&times;</i>产品型号</label>
                                    <div class="col-md-10">
                                        <input class="form-control" name="type" placeholder="请输入产品型号" value="{{$infos['type']}}" type="text">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label"><i>&times;</i>产品规格</label>
                                    <div class="col-md-10">
                                        <input class="form-control" name="standard" placeholder="请输入产品规格" value="{{$infos['standard']}}" type="text">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label"><i>&times;</i>产品单价</label>
                                    <div class="col-md-10">
                                        <input class="form-control" name="price" placeholder="请输入产品单价" value="{{$infos['price']}}"  type="text">
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <input type="hidden" name="pid" value="{{$pid}}">
                                            <button class="btn btn-primary" type="button" @click="formSub">
                                                <i class="fa fa-save"></i>
                                                修改
                                            </button>
                                        </div>
                                    </div>
                                </div>
    
                            </form>
    
                        </div>
                        <!-- end widget content -->
    
                    </div>
                    <!-- end widget div -->
                </div>
            </article>
        </div>
    </section>    
</div>

<script type="text/javascript">

    var vm = new Vue({
        el:"#content",
        data:{ },
        methods:{
            // 提交
            formSub:function(){
                // 产品名称
                if($("input[name='name']").val() == ""){
                    $("input[name='name']").parents(".form-group").find("label i").show();
                    return;
                }else{
                    $("input[name='name']").parents(".form-group").find("label i").hide();
                }
                //产品型号
                if($("input[name='type']").val() == ""){
                    $("input[name='type']").parents(".form-group").find("label i").show();
                    return;
                }else{
                    $("input[name='type']").parents(".form-group").find("label i").hide();
                }
                //产品规格
                if($("input[name='standard']").val() == ""){
                    $("input[name='standard']").parents(".form-group").find("label i").show();
                    return;
                }else{
                    $("input[name='standard']").parents(".form-group").find("label i").hide();
                }
                //产品单价
                if($("input[name='price']").val() == ""){
                    $("input[name='price']").parents(".form-group").find("label i").show();
                    return;
                }else{
                    $("input[name='price']").parents(".form-group").find("label i").hide();
                }
                // 风采照片
                if($("input[name='p_img']").parents(".form-group").find(".img_box img").length == "0"){
                    $("input[name='p_img']").parents(".form-group").find("label i").show();
                    return;
                }else{
                    $("input[name='p_img']").parents(".form-group").find("label i").hide();
                }
                $("#regForm").submit();
            }
        },
    })
    vm.$watch("createrShow",function(newVla,oldVal){
        if(newVla === true){
            $(".createrBox>input").focus().val("");
            $(".createrName").css({
                border:"1px solid #66afe9",
                borderBottom:"none"
            })
        }else{
            $(".createrName").css({
                border:"1px solid #ccc",
            })
        }
    });
</script>


<include file="layout/footer" />